﻿using System;
using Commons;
using System.Windows.Forms;
using CsGo.User;

namespace Start
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
            LoginView dlg = new LoginView();
            if (DialogResult.OK == dlg.ShowDialog())
            {
                if (dlg.bLogin)
                {
                    Application.Run(new MainForm());
                }
            }
            dlg.Dispose();
        }

        private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs ex)
        {
            if (DialogResult.Yes == "系统发生错误，您需要退出系统吗？".ShowYesNoAndError())
            {
                Application.Exit();
            }
        }
    }
}
